#include "LcFrame.h"

// begin wxGlade: ::extracode

// end wxGlade


LcFrame::LcFrame(struct event_base* evbase,
                 wxWindow* parent,
                 int id,
                 const wxString& title,
                 const wxPoint& pos,
                 const wxSize& size,
                 long style)
    : wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
    , evbase(evbase)
{
    // begin wxGlade: LcFrame::LcFrame
    panel_light = new LcPanel(this, wxID_ANY);
    list_ctrl_sv = new wxListCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER);
    frame_1_statusbar = CreateStatusBar(1, 0);

    set_properties();
    do_layout();
    // end wxGlade
}


BEGIN_EVENT_TABLE(LcFrame, wxFrame)
    // begin wxGlade: LcFrame::event_table
    EVT_LIST_ITEM_ACTIVATED(wxID_ANY, LcFrame::OnItemActivated)
    // end wxGlade
END_EVENT_TABLE();


void LcFrame::OnItemActivated(wxListEvent &event)
{
    event.Skip();
    wxLogDebug(wxT("Event handler (LcFrame::OnItemActivated) not implemented yet"));
}


// wxGlade: add LcFrame event handlers


void LcFrame::set_properties()
{
    // begin wxGlade: LcFrame::set_properties
    SetTitle(wxT("Lighting Control"));
    SetSize(wxSize(300, 300));
    int frame_1_statusbar_widths[] = { -1 };
    frame_1_statusbar->SetStatusWidths(1, frame_1_statusbar_widths);
    const wxString frame_1_statusbar_fields[] = {
        wxEmptyString
    };
    for(int i = 0; i < frame_1_statusbar->GetFieldsCount(); ++i) {
        frame_1_statusbar->SetStatusText(frame_1_statusbar_fields[i], i);
    }
    // end wxGlade

    list_ctrl_sv->InsertColumn(0, _("State Variable"));
    list_ctrl_sv->SetColumnWidth(0, 130);
    list_ctrl_sv->InsertColumn(1, _("Value"));
    list_ctrl_sv->SetColumnWidth(1, 100);

    list_ctrl_sv->InsertItem(0, _("Target"));
    list_ctrl_sv->SetItem(0, 1, _("0"));
    list_ctrl_sv->InsertItem(1, _("Status"));
    list_ctrl_sv->SetItem(1, 1, _("0"));
}


void LcFrame::do_layout()
{
    // begin wxGlade: LcFrame::do_layout
    wxFlexGridSizer* grid_sizer_1 = new wxFlexGridSizer(2, 1, 0, 0);
    grid_sizer_1->Add(panel_light, 1, wxEXPAND, 0);
    grid_sizer_1->Add(list_ctrl_sv, 1, wxEXPAND, 0);
    SetSizer(grid_sizer_1);
    grid_sizer_1->AddGrowableRow(1);
    grid_sizer_1->AddGrowableCol(0);
    Layout();
    // end wxGlade
}

